package com.wego.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wego.common.base.impl.BaseServiceImpl;
import com.wego.common.bean.PageBean;
import com.wego.entity.domain.Order;
import com.wego.entity.query.OrderQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wego.mapper.OrderMapper;
import com.wego.service.OrderService;
@Service
public class OrderServiceImpl extends BaseServiceImpl<Order> implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public PageBean<Order> selectPage(OrderQuery orderQuery) {
        //设置分页信息
        Page<Order> page = PageHelper.startPage(orderQuery.getPageNum(), orderQuery.getPageSize());
        //查询数据
        orderMapper.selectList(orderQuery);
        //将MyBatis提供的Page对象转换成我们自己的PageBean对象
        PageBean<Order> pageBean = new PageBean<>(page);
        return pageBean;
    }

    @Override
    public int selectCount(Order order) {
        return orderMapper.selectCount(order);
    }

}

